const express = require('express');

const multer = require('multer');

const path = require('path');

const expressJoi = require('@escook/express-joi');
const { add_article_schema } = require('../schema/articles');

const upload = multer({ dest: path.join(__dirname, '../uploads') });

const router = express.Router();

const articles_handler = require('../router_handler/articles');

router.post(
  '/add',
  upload.single('cover_img'),
  expressJoi(add_article_schema),
  articles_handler.addArt
);

module.exports = router;
